﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace wxtools
{
    public partial class tt : Form
    {
        public tt()
        {
            InitializeComponent();
        }

        private void tt_Load(object sender, EventArgs e)
        {
            WxListBoxItem item = new WxListBoxItem();
            byte[] bytes = WxTools.HttpGetBytes("https://avatar.csdn.net/5/5/E/1_crystal_lz.jpg?1517533228");
            //item.Image = Image.FromStream(new MemoryStream(bytes));
            Bitmap bmp = new Bitmap(38, 38);
            Graphics g = Graphics.FromImage(bmp);
            g.Clear(Color.Red);
            g.Dispose();
            item.Image = bmp;
            item.IsClass = true;
            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            item.Classid = 100;
            item.IsExpand = false;
            wxListBox1.Items.Add(item);

            item.IsClass = false;
            //item.Image = Image.FromStream(new MemoryStream(bytes));
            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";

            wxListBox1.Items.Add(item);
            //item.Image = Image.FromStream(new MemoryStream(bytes));
            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";

            wxListBox1.Items.Add(item);
            //item.Image = Image.FromStream(new MemoryStream(bytes));

            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);


            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);


            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);


            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);

            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);

            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);

            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);

            item.Title = "Title";
            item.Text = "Text";
            item.Remarks = "Remarks";
            wxListBox1.Items.Add(item);
        }

        frmProgress f;
        private void wxListBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            //MessageBox.Show(e.Location+"111");
            System.Threading.Thread th = new System.Threading.Thread(syncThread);
            th.IsBackground = true;
            th.Start();

            f = new frmProgress();
            f.ShowDialog();
        }

        private void syncThread()
        {
            if (f != null )
            {
                for (int i = 1; i <= 10; i++)
                {
                    f.setValue(i*10,"创建群聊成功" + WxConfig.ChatRoomName + "");
                    System.Threading.Thread.Sleep(500);
                }
            }
        }
    }
}
